//
//  MyCouponTableViewCell.m
//  jingjing2.0
//
//  Created by apple on 16/5/22.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "MyCouponTableViewCell.h"

@implementation MyCouponTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.backgroundColor = [UIColor whiteColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        _itemImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, 5)];
        _itemImageView.image = [UIImage imageNamed:@"coupon_item_top_bg.jpg"];
        _itemImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        [self addSubview:_itemImageView];
        
        _categoryNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(_itemImageView.frame)+10, 100, 20)];
        _categoryNameLabel.textColor = BLUECOLOR;
        _categoryNameLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;
        [self addSubview:_categoryNameLabel];
        
        CGFloat width = [@"20" sizeWithAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:30]}].width;
        _showMoneyLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(_categoryNameLabel.frame)+15, width, 25)];
        _showMoneyLabel.textColor = BLUECOLOR;
        _showMoneyLabel.adjustsFontSizeToFitWidth = YES;
        _showMoneyLabel.textAlignment = NSTextAlignmentCenter;
        _showMoneyLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;
        _showMoneyLabel.font = [UIFont boldSystemFontOfSize:30];
        [self addSubview:_showMoneyLabel];
        
        _showSuffixLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_showMoneyLabel.frame), CGRectGetMaxY(_categoryNameLabel.frame)+20, 50, 20)];
        _showSuffixLabel.font = [UIFont systemFontOfSize:14];
        _showSuffixLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;
        _showSuffixLabel.textColor = BLUECOLOR;
        [self addSubview:_showSuffixLabel];
        
        _couponNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_categoryNameLabel.frame), CGRectGetMaxY(_itemImageView.frame)+8, 180, 20)];
        _couponNameLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;
        _couponNameLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:_couponNameLabel];
        
        _cityNamesLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_categoryNameLabel.frame), CGRectGetMaxY(_couponNameLabel.frame)+1, 180, 20)];
        _cityNamesLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;
        _cityNamesLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:_cityNamesLabel];
        
        _categoryNamesLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_categoryNameLabel.frame), CGRectGetMaxY(_cityNamesLabel.frame)+1, 200, 20)];
        _categoryNamesLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;
        _categoryNamesLabel.textColor = GRAYCOLOR;
        _categoryNamesLabel.font = [UIFont systemFontOfSize:13];
        [self addSubview:_categoryNamesLabel];
        
        UIView * lineView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_categoryNamesLabel.frame)+10, self.frame.size.width, 1)];
        lineView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin|UIViewAutoresizingFlexibleWidth;
        lineView.backgroundColor = GRAYCOLOR;
        [self addSubview:lineView];
        
        _showDateLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(lineView.frame), self.frame.size.width-20, 40)];
        _showDateLabel.textColor = [UIColor grayColor];
        _showDateLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleBottomMargin;
        _showDateLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:_showDateLabel];
        
    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
